<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8" />
    <title>Tables</title>

    <!-- Bootstrap -->
    <link href="<%=basePath%>bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>assets/styles.css" rel="stylesheet" media="screen">
    <link href="<%=basePath%>assets/DT_bootstrap.css" rel="stylesheet" media="screen">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="vendors/flot/excanvas.min.js"></script><![endif]-->
    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src="<%=basePath%>vendors/modernizr-2.6.2-respond-1.1.0.min.js"></script>
    <script src="<%=basePath%>js/jquery.min.js"></script>
    <script src="<%=basePath%>js/mobiscroll_002.js" type="text/javascript"></script>
    <script src="<%=basePath%>js/mobiscroll_004.js" type="text/javascript"></script>
    <link href="<%=basePath%>js/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="<%=basePath%>js/mobiscroll.css" rel="stylesheet" type="text/css">
    <script src="<%=basePath%>js/mobiscroll.js" type="text/javascript"></script>
    <script src="<%=basePath%>js/mobiscroll_003.js" type="text/javascript"></script>
    <script src="<%=basePath%>js/mobiscroll_005.js" type="text/javascript"></script>
    <link href="<%=basePath%>js/mobiscroll_003.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="<%=basePath%>js/jquery-1.7.2.js"></script>
    <script type="text/javascript" src="<%=basePath%>js/jquery.jedate.js"></script>
    <link type="text/css" rel="stylesheet" href="<%=basePath%>assets/jedate.css">

</head>
<body>
<%
    if(request.getSession().getAttribute("acc") == null) {
        response.sendRedirect("../emp/adminLogin");
    }
%>
	<div class="navbar navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </a>
           <a class="brand">麦包郎后台管理系统</a>

            <!--/.nav-collapse -->
        </div>
    </div>
</div>
<div class="container-fluid">
    <div class="row-fluid">
        <div class="span3" id="sidebar">
            <ul class="nav nav-list bs-docs-sidenav nav-collapse collapse">
                <li>
					<a href="<%=basePath%>emp/getAll"><i class="icon-chevron-right"></i> 店铺管理</a>
				</li>
					
				<li>
					<a href="<%=basePath%>shop/today"><i class="icon-chevron-right"></i>今日订单 </a>
				</li>

				<li>
					<a href="<%=basePath%>ord/selectli"><i class="icon-chevron-right"></i> 历史订单</a>
				</li>

						
				<li>
					<a href="<%=basePath%>commodity/tong"><i class="icon-chevron-right"></i>食材管理</a>
				</li>
				<li class="active">
					<a href="<%=basePath%>ord/caiwu"><i class="icon-chevron-right"></i>财务管理</a>
				</li>

            </ul>
        </div>
        <!--/span-->
        <div class="span9" id="content">





            <div class="row-fluid">
                <!-- block -->
                <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">财务管理</div>

                        &nbsp;  &nbsp; <input style="margin-top: 5px;" class="xiugai1" id="date04" type="button" placeholder="YYYY-MM" value="${time}" >
                        &nbsp;  &nbsp;

                        <input style="margin-top: 5px;" value="确定 " class="xiugai" type="button" onclick="ti()"  />
                        <div style="height:15px; margin-left: 10px;float: right"  class="yzj">
                            <p style="position: relative;top: -5px;">月所有门店总计：<span><fmt:formatNumber type="number" value="${total}" maxFractionDigits="1"/>元</span></p>
                        </div>
                        <div id="datePlugin"></div>

                    </div>
                    <div class="block-content collapse in">
                        <div class="block-content collapse in">
                            <div class="span12">

                                <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
                                    <thead>
                                    <tr>
                                        <th>店铺名称</th>
                                        <th>1--10号账单</th>
                                        <th>11--20号账单</th>
                                        <th>21--31号账单</th>
                                        <th>月总账</th>
										<th>年总账</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${list}" var="li">
                                    <tr class="odd gradeX">
                                        <td>${li.name}</td>
                                        <td class="center"><button class="btn btn-info" onclick="xiang(${li.id},1)">详情</button></td>
                                        <td class="center"><button class="btn btn-info" onclick="xiang(${li.id},2)">详情</button></td>
                                        <td class="center"><button class="btn btn-info" onclick="xiang(${li.id},3)">详情</button></td>
                                        <td class="center"><%-- <div class="btn-info"><fmt:formatNumber type="number" value="${li.total}" maxFractionDigits="1"/>元</div> --%>
                                        	<button class="btn btn-info" onclick="monXiang(${li.id})">详情</button>
                                        </td>
                                         <td class="center">
                                        	<button class="btn btn-info" onclick="yearXiang(${li.id})">详情</button>
                                        </td>
                                    </tr>
                                    </c:forEach> 
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- /block -->
            </div>


        </div>
    </div>
    <hr>

</div>
<!--/.fluid-container-->

<!--<script src="vendors/jquery-1.9.1.js"></script>-->
<script src="<%=basePath%>bootstrap/js/bootstrap.min.js"></script>
<script src="<%=basePath%>vendors/datatables/js/jquery.dataTables.min.js"></script>


<script src="<%=basePath%>assets/scripts.js"></script>
<script src="<%=basePath%>assets/DT_bootstrap.js"></script>

</body>
<script type="text/javascript">
    $(function () {
        var currYear = (new Date()).getFullYear();
        var opt={};
        opt.date = {preset : 'date'};
        opt.datetime = {preset : 'datetime'};
        opt.time = {preset : 'time'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'modal', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yyyy-mm-dd',
            lang: 'zh',
            showNow: true,
            nowText: "今天",
            startYear: currYear - 10, //开始年份
            endYear: currYear + 10 //结束年份
        };

        $("#appDate").mobiscroll($.extend(opt['date'], opt['default']));
        var optDateTime = $.extend(opt['datetime'], opt['default']);
        var optTime = $.extend(opt['time'], opt['default']);
        $("#appDateTime").mobiscroll(optDateTime).datetime(optDateTime);
        $("#appTime").mobiscroll(optTime).time(optTime);
    });




    //实现日期选择联动
    var start = {
        format: 'YYYY-MM-DD',
        minDate: '2014-06-16 23:59:59', //设定最小日期为当前日期
        //festival:true,
        maxDate: $.nowDate({DD:0}), //最大日期
        choosefun: function(elem,datas){
            end.minDate = datas; //开始日选好后，重置结束日的最小日期
            endDates();
        },
        okfun:function (elem,datas) {
            alert(datas)
        }
    };

    $("#date04").jeDate({
        isinitVal:true,
        //festival:true,
        ishmsVal:false,
        minDate: '2016-06-16 23:59:59',
        maxDate: $.nowDate({DD:0}),
        format:"YYYY-MM",
        zIndex:3000,
    });
    
    function ti(){
    	var time=$("#date04").val();
    	window.location.href="selectMon?time="+time; 
    }
    
    function xiang(id,num){
    	var time=$("#date04").val();
    	window.location.href="selectTenDay?num="+num+"&time="+time+"&id="+id; 
    }
    
    function monXiang(id){
    	var time=$("#date04").val();
    	window.location.href="selectByUserIdMon?time="+time+"&id="+id; 
    }
    
    
    function yearXiang(id){
    	var time=$("#date04").val();
    	window.location.href="selectByUserIdYear?time="+time+"&id="+id; 
    }
    
</script>

	
</body>
</html>